<%@ page import = "org.json.simple.*, java.util.TreeMap, com.classes.Casemast,java.util.ArrayList, org.owasp.encoder.Encode" %>
<%
String app_type = "";
String ownership_status = "";
String reg_name = "";
String reg_no = "";
String desc = "";
String mcc_code = "";
String paid_up_capital = "";
String recall_barcode = "";
String gst_registration = "";
String rmcd_approval_no = "";
String year_in_business = "";
String avg_ticket_size = "";
String curr_acquirer = "";
String curr_bank = "";
String curr_acc_no = "";
String curr_avg_deposit = "0.00";
String curr_avg_deposit_dtl = "";
String amex_auth_sign = "";
ArrayList<TreeMap<String, String>> avg_deposit_dtl = new ArrayList<TreeMap<String, String>>();
ArrayList<TreeMap<String, String>> amex_entries = new ArrayList<TreeMap<String, String>>();

if(request.getAttribute("m_case") != null) {
	app_type = ((Casemast)request.getAttribute("m_case")).getType();
	ownership_status = ((Casemast)request.getAttribute("m_case")).getMerchant().getOwnershipStatus();
	reg_name = ((Casemast)request.getAttribute("m_case")).getMerchant().getRegisteredName();
	reg_no = ((Casemast)request.getAttribute("m_case")).getMerchant().getRegisteredNo();
	desc = ((Casemast)request.getAttribute("m_case")).getMerchant().getDesc();
	mcc_code = ((Casemast)request.getAttribute("m_case")).getMerchant().getMCCCode();
	paid_up_capital = ((Casemast)request.getAttribute("m_case")).getMerchant().getPaidUpCapital();
	recall_barcode = ((Casemast)request.getAttribute("m_case")).getMerchant().getRecallBarcode();
	gst_registration = ((Casemast)request.getAttribute("m_case")).getMerchant().getGst_registration();
	rmcd_approval_no = ((Casemast)request.getAttribute("m_case")).getMerchant().getRmcd_approval_no();
	year_in_business = ((Casemast)request.getAttribute("m_case")).getMerchant().getYearInBusiness();
	avg_ticket_size = ((Casemast)request.getAttribute("m_case")).getMerchant().getAvgTicketSize();
	curr_acquirer = ((Casemast)request.getAttribute("m_case")).getAcquirer();
	curr_bank = ((Casemast)request.getAttribute("m_case")).getMerchant().getCurrBank();
	curr_acc_no = ((Casemast)request.getAttribute("m_case")).getMerchant().getCurrAccNo();
	curr_avg_deposit = ((Casemast)request.getAttribute("m_case")).getMerchant().getCurrAvgDeposit();
	curr_avg_deposit_dtl = ((Casemast)request.getAttribute("m_case")).getMerchant().getCurrAvgDepositDtl();
	amex_auth_sign = ((Casemast)request.getAttribute("m_case")).getMerchant().getAmexAuthSign();
	
	
	JSONArray avg_deposit_arr = (JSONArray) JSONValue.parse(curr_avg_deposit_dtl);
	for(int k = 0; k < avg_deposit_arr.size(); k++) {
		String string = avg_deposit_arr.get(k).toString();
		JSONObject obj = (JSONObject)JSONValue.parse(string);
		TreeMap<String, String> temp = new TreeMap<String, String>();
		
		String month = (obj.get("month") == null) ? "" : obj.get("month").toString().trim();
		String total_deposit = (obj.get("total_deposit") == null) ? "" : obj.get("total_deposit").toString().trim();
		String balance = (obj.get("balance") == null) ? "" : obj.get("balance").toString().trim();
		
		temp.put("month", month);
		temp.put("total_deposit", total_deposit);
		temp.put("balance", balance);
		
		avg_deposit_dtl.add(temp);
	}
	
	
	JSONArray amex_auth_sign_arr = (JSONArray) JSONValue.parse(amex_auth_sign);
	for(int k = 0; k < amex_auth_sign_arr.size(); k++) {
		String string = amex_auth_sign_arr.get(k).toString();
		JSONObject obj = (JSONObject)JSONValue.parse(string);
		TreeMap<String, String> temp = new TreeMap<String, String>();
		
		String title = (obj.get("title") == null) ? "" : obj.get("title").toString().trim();
		String name = (obj.get("name") == null) ? "" : obj.get("name").toString().trim();
		String designation = (obj.get("designation") == null) ? "" : obj.get("designation").toString().trim();
		String ic_no = (obj.get("ic_no") == null) ? "" : obj.get("ic_no").toString().trim();
		String date_of_birth = (obj.get("date_of_birth") == null) ? "" : obj.get("date_of_birth").toString().trim();
		String gender = (obj.get("gender") == null) ? "" : obj.get("gender").toString().trim();
		
		temp.put("title", title);
		temp.put("name", name);
		temp.put("designation", designation);
		temp.put("ic", ic_no);
		temp.put("dob", date_of_birth);
		temp.put("gender", gender);
		
		amex_entries.add(temp);
	}
}

%>

<div class="row-fluid page">
	<div class="span12">
		
		
		<div class="section-header">Case Transition</div>
		
		<div class="row-fluid">
			<div class="span12">
				
				<table class="tblDetails" style="margin-top:0px"><thead>
					<tr>
						<th>Action</th>
						<th>To Status</th>
						<th>From Status</th>
						<th>Note / Comment</th>
						<th>Assigned To</th>
						<th>By</th>
						<th>Date</th>
					</tr>
				</thead><tbody>
				<%
					ArrayList<TreeMap<String, String>> histArr = ((Casemast) request.getAttribute("m_case")).getHistories();
					if(histArr != null){
						int n = 0;
						for(TreeMap<String, String> histLog : histArr){
							String html = "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
							+ "	<td>" + Encode.forHtml(histLog.get("action")) + "</td>"
							+ "	<td>" + Encode.forHtml(histLog.get("status")) + "</td>"
							+ "	<td>" + Encode.forHtml(histLog.get("last_status")) + "</td>"
							+ "	<td>" + Encode.forHtml(histLog.get("note")) + "</td>"
							+ "	<td>" + Encode.forHtml(histLog.get("assigned_to")) + "</td>"
							+ "	<td>" + Encode.forHtml(histLog.get("created_by")) + "</td>"
							+ "	<td>" + Casemast.formatCreatedDate("dd/MM/yyyy HH:mm", Long.parseLong(histLog.get("created_date"))) + "</td>"
							+ "</tr>";
							
							out.println(html);
							++n;
						}
					}
				%>
				</tbody></table>
				
			</div>
		</div>
		
		
		<div class="section-header">Terminal Installation</div>
		
		<div class="row-fluid">
			<div class="span8">
				
				<table class="tblDetails" style="margin-top:0px"><thead>
					<tr>
						<th>Action [Status]</th>
						<th>By</th>
						<th>Date</th>
					</tr>
				</thead><tbody>
				<%
					ArrayList<TreeMap<String, String>> histArr2 = ((Casemast) request.getAttribute("m_case")).getHistories2();
					if(histArr2 != null){
						int n = 0;
						for(TreeMap<String, String> histLog : histArr2){
							String html = "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
							+ "	<td>" + histLog.get("action") + " [" + histLog.get("status") +  "]</td>"
							+ "	<td>" + histLog.get("created_by") + "</td>"
							+ "	<td>" + Casemast.formatCreatedDate("dd/MM/yyyy HH:mm", Long.parseLong(histLog.get("created_date"))) + "</td>"
							+ "</tr>";
							
							out.println(html);
							++n;
						}
					}
				%>
				</tbody></table>
				
			</div>
		</div>
		
		<div class="section-header">External Remark</div>
		
		<div class="row-fluid">
			<div class="span12">
			<%
				String external_remark = ((Casemast)request.getAttribute("m_case")).getExternalRemark();
				if(external_remark.equals("")) {
					external_remark = "<em>Not available.</em>";
				}
				String html = "<pre>" + external_remark + "</pre>";
				out.print(html);
			%>
			</div>
		</div>
		
		<div class="section-header">Business Detail</div>
		<div class="row-fluid" style="margin-bottom:20px">
			<div class="span3">
				<select id="app_type">
					<%
						html = "<option value=''>"
								+ 	"<option value='New Application'>New Application</option>"
								+ 	"<option value='Extend Facility'>Extend Facility</option>"
								+ 	"<option value='e-Commerce/M2u'>e-Commerce/M2u</option>";
								
						html = html.replace("<option value='" + app_type + "'>", "<option value='" + app_type + "' selected>");
					
						out.println(html);
					%>
				</select>
			</div>
				
			<div class="span2" style="text-align:right; line-height:20px">
				Ownership Status
			</div>
			
			<div class="span7" id="ownership_status">
				<%
					html = "<label class='radio inline-block'><input type='radio' name='ownership_status' value='Sole Proprietary' />Sole Proprietary</label>"
			    	+ "<label class='radio inline-block'><input type='radio' name='ownership_status' value='Partnership' />Partnership</label>"
					+ "<label class='radio inline-block'><input type='radio' name='ownership_status' value='Private Limited' />Private Limited</label>"
					+ "<label class='radio inline-block'><input type='radio' name='ownership_status' value='Public Listed' />Public Listed</label>"
					+ "<label class='radio inline-block'><input type='radio' name='ownership_status' value='Professional' />Professional</label>"
					+ "<label class='radio inline-block'><input type='radio' name='ownership_status' value='Government' />Government</label>"
					+ "<label class='radio inline-block'><input type='radio' name='ownership_status' value='Others' />Others</label>";
					
					html = html.replace("value='" + ownership_status + "'", "value='" + ownership_status + "' checked ");
				
					out.println(html);
				%>
			</div>
		</div>
		
		<div class="form-horizontal merchant-main-content">
			<div class="row-fluid">
				<div class="span6">
					<div class="control-group">
						<label class="control-label"><span class="must">*</span>Registered Name</label>
						<div class="controls">
							<input type="text" id="registered_name" value="<%= reg_name %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label"><span class="must">*</span>Nature of Business</label>
						<div class="controls">
							<input type="text" id="nature_of_business" value="<%= desc %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Paid up Capital</label>
						<div class="controls">
							<input type="text" id="paid_up_capital" value="<%= paid_up_capital %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label"><span class="must">*</span>No. of Years in Business</label>
						<div class="controls">
							<select id="years_in_business">
								<option value=""></option>
								<%
								    html = "<option value='less_than_6m'>Less than 6 months</option>"
								    	+ "<option value='more_than_6m'>More than 6 months</option>"
										+ "<option value='1y_to_3y'>1-3 Years</option>"
										+ "<option value='4y_to_7y'>4-7 Years</option>"
										+ "<option value='8y_to_10y'>8-10 Years</option>"
										+ "<option value='more_than_10y'>More than 10 Years</option>";
										
									html = html.replace("<option value='" + year_in_business + "'>", "<option value='" + year_in_business + "' selected />");
								
									out.println(html);
								%>
							</select>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Average Ticket Size</label>
						<div class="controls">
							<input type="text" id="avr_ticket_size" value="<%= avg_ticket_size %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Current Acquirer</label>
						<div class="controls">
							<select id="current_acquirer">
								<option value=""></option>
								<% 
									html = "<option value=\"AFFIN BANK BERHAD\">AFFIN BANK BERHAD</option>"
											+ "<option value=\"ALLIANCE BANK M'SIA BHD\">ALLIANCE BANK M'SIA BHD</option>"
											+ "<option value=\"AMBANK BERHAD\">AMBANK BERHAD</option>"
											+ "<option value=\"BANK ISLAM MALAYSIA BHD\">BANK ISLAM MALAYSIA BHD</option>"
											+ "<option value=\"CIMB BANK BERHAD\">CIMB BANK BERHAD</option>"
											+ "<option value=\"CITIBANK BERHAD\">CITIBANK BERHAD</option>"
											+ "<option value=\"HONG LEONG BANK BHD\">HONG LEONG BANK BHD</option>"
											+ "<option value=\"HSBC BERHAD\">HSBC BERHAD</option>"
											+ "<option value=\"MALAYAN BANKING BERHAD\">MALAYAN BANKING BERHAD</option>"
											+ "<option value=\"OCBC BANK(M'SIA) BHD\">OCBC BANK(M'SIA) BHD</option>"
											+ "<option value=\"PUBLIC BANK BHD\">PUBLIC BANK BHD</option>"
											+ "<option value=\"RHB BANK BERHAD\">RHB BANK BERHAD</option>"
											+ "<option value=\"STANDARD CHARTERED BANK\">STANDARD CHARTERED BANK</option>"
											+ "<option value=\"UNITED OVERSEAS BANK\">UNITED OVERSEAS BANK</option>";
									
									html = html.replace("<option value=\"" + curr_acquirer + "\">", "<option value=\"" + curr_acquirer + "\" selected />");		
									out.println(html);
								%>
							</select>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">&#8226;&nbsp;&nbsp;Bank Name</label>
						<div class="controls">
							<select id="bank_name">
								<option value=""></option>
								<% 
									html = "<option value=\"AFFIN BANK BERHAD\">AFFIN BANK BERHAD</option>"
											+ "<option value=\"ALLIANCE BANK MALAYSIA BHD\">ALLIANCE BANK MALAYSIA BHD</option>"
											+ "<option value=\"AL-RAJHI BANKING & INVESTMENT CORP (M) BHD\">AL-RAJHI BANKING & INVESTMENT CORP (M) BHD</option>"
											+ "<option value=\"AMBANK BERHAD\">AMBANK BERHAD</option>"
											+ "<option value=\"BANK ISLAM MALAYSIA\">BANK ISLAM MALAYSIA</option>"
											+ "<option value=\"BANK KERJASAMA RAKYAT MALAYSIA BHD\">BANK KERJASAMA RAKYAT MALAYSIA BHD</option>"
											+ "<option value=\"BANK MUAMALAT\">BANK MUAMALAT</option>"
											+ "<option value=\"BANK OF AMERICA\">BANK OF AMERICA</option>"
											+ "<option value=\"BANK OF CHINA\">BANK OF CHINA</option>"
											+ "<option value=\"BANK OF TOKYO\">BANK OF TOKYO</option>"
											+ "<option value=\"BANK PERTANIAN MALAYSIA BHD (AGRO BANK)\">BANK PERTANIAN MALAYSIA BHD (AGRO BANK)</option>"
											+ "<option value=\"BANK RAKYAT MALAYSIA\">BANK RAKYAT MALAYSIA</option>"
											+ "<option value=\"BANK SIMPANAN NASIONAL BHD\">BANK SIMPANAN NASIONAL BHD</option>"
											+ "<option value=\"BNP PARIBAS MALAYSIA\">BNP PARIBAS MALAYSIA</option>"
											+ "<option value=\"CIMB BANK BERHAD\">CIMB BANK BERHAD</option>"
											+ "<option value=\"CITIBANK BERHAD\">CITIBANK BERHAD</option>"
											+ "<option value=\"DEUTSCHE BANK (M) BHD\">DEUTSCHE BANK (M) BHD</option>"
											+ "<option value=\"EON BANK BERHAD\">EON BANK BERHAD</option>"
											+ "<option value=\"HONG LEONG BANK BHD\">HONG LEONG BANK BHD</option>"
											+ "<option value=\"HSBC BANK MALAYSIA BERHAD\">HSBC BANK MALAYSIA BERHAD</option>"
											+ "<option value=\"J.P. MORGAN CHASE BANK BHD\">J.P. MORGAN CHASE BANK BHD</option>"
											+ "<option value=\"KUWAIT FINANCE HOUSE\">KUWAIT FINANCE HOUSE</option>"
											+ "<option value=\"MIZUHO CORPORATE BANK MALAYSIA\">MIZUHO CORPORATE BANK MALAYSIA</option>"
											+ "<option value=\"OCBC BANK (M) BHD\">OCBC BANK (M) BHD</option>"
											+ "<option value=\"PUBLIC BANK BHD\">PUBLIC BANK BHD</option>"
											+ "<option value=\"RHB BANK BERHAD\">RHB BANK BERHAD</option>"
											+ "<option value=\"ROYAL BANK OF SCOTLAND\">ROYAL BANK OF SCOTLAND</option>"
											+ "<option value=\"STANDARD CHARTERED BANK\">STANDARD CHARTERED BANK</option>"
											+ "<option value=\"SUMITOMO MITSUI BANK CORPORATION MALAYSIA BHD\">SUMITOMO MITSUI BANK CORPORATION MALAYSIA BHD</option>"
											+ "<option value=\"THE ROYAL BANK OF SCOTLAND BHD\">THE ROYAL BANK OF SCOTLAND BHD</option>"
											+ "<option value=\"UNITED OVERSEAS BANK BHD\">UNITED OVERSEAS BANK BHD</option>";
									
									html = html.replace("<option value=\"" + curr_bank + "\">", "<option value=\"" + curr_bank + "\" selected />");		
									out.println(html);
								%>
							</select>
						</div>
					</div>
					
					<div class="control-group" style="width:900px">
						<label class="control-label">&#8226;&nbsp;&nbsp;Current Account No.</label>
						<div class="controls">
							<input type="text" id="current_acc_no" value="<%= curr_acc_no %>" />
							<strong>&nbsp;&nbsp;&#8226;&nbsp;&nbsp;Applicable for Non-Maybank Current Account</strong>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">&#8226;&nbsp;&nbsp;Average Monthly Deposit</label>
						<div class="controls">
							<input type="text" id="avr_monthly_deposit" readonly="readonly" value="<%= curr_avg_deposit %>" />
						</div>
					</div>
				</div>
				
				<div class="span6">
					<div class="control-group">
						<label class="control-label">Registered No.</label>
						<div class="controls">
							<input type="text" id="registered_no" value="<%= reg_no %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label"><span class="must">*</span>MCC Code</label>
						<div class="controls">
							<input type="text" id="mcc_code" value="<%= mcc_code %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Recall Barcode No.</label>
						<div class="controls">
							<input type="text" id="recall_barcode_no" value="<%= recall_barcode %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">GST Registration</label>
						<div class="controls">
							<input type="text" id="gst_registration" value="<%= gst_registration %>" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">RMCD Approval No.</label>
						<div class="controls">
							<input type="text" id="rmcd_approval_no" value="<%= rmcd_approval_no %>" />
						</div>
					</div>
				</div>
			</div>
		</div>
		
		<div class="row-fluid">
			<div class="span7">
				<table class="tbl monthly_deposit_tbl">
					<thead>
						<tr>
							<th style="width:32%">Month</th>
							<th style="width:34%">Total Deposit(RM)</th>
							<th style="width:34%">Balance(RM)</th>
						</tr>
					</thead>
					<tbody>
						<tr data-index="1">
							<td>
								<select name="month">
									<option value=""></option>
								<%
									html = "<option value='01'>January</option>"
										+ "<option value='02'>February</option>"
										+ "<option value='03'>March</option>"
										+ "<option value='04'>April</option>"
										+ "<option value='05'>May</option>"
										+ "<option value='06'>June</option>"
										+ "<option value='07'>July</option>"
										+ "<option value='08'>August</option>"
										+ "<option value='09'>September</option>"
										+ "<option value='10'>October</option>"
										+ "<option value='11'>November</option>"
										+ "<option value='12'>December</option>";
									
									if(avg_deposit_dtl.isEmpty() == false) {
										html = html.replace("<option value='" + avg_deposit_dtl.get(0).get("month") + "'>", "<option value='" + avg_deposit_dtl.get(0).get("month") + "' selected />");
									}
									
									out.println(html);
								%>
								</select>
							</td>
							<td><input type="text" id="total_deposit" name="total_deposit" class="number" value="<%= avg_deposit_dtl.isEmpty() == false ? avg_deposit_dtl.get(0).get("total_deposit") : "" %>" /></td>
							<td><input type="text" name="balance" class="number" value="<%= avg_deposit_dtl.isEmpty() == false ? avg_deposit_dtl.get(0).get("balance") : "" %>" /></td>
						</tr>
						
						<tr data-index="2">
							<td>
								<select name="month">
									<option value=""></option>
								<%
									html = "<option value='01'>January</option>"
										+ "<option value='02'>February</option>"
										+ "<option value='03'>March</option>"
										+ "<option value='04'>April</option>"
										+ "<option value='05'>May</option>"
										+ "<option value='06'>June</option>"
										+ "<option value='07'>July</option>"
										+ "<option value='08'>August</option>"
										+ "<option value='09'>September</option>"
										+ "<option value='10'>October</option>"
										+ "<option value='11'>November</option>"
										+ "<option value='12'>December</option>";
									
									if(avg_deposit_dtl.isEmpty() == false) {
										html = html.replace("<option value='" + avg_deposit_dtl.get(1).get("month") + "'>", "<option value='" + avg_deposit_dtl.get(1).get("month") + "' selected />");
									}
									
									out.println(html);
								%>
								</select>
							</td>
							<td><input type="text" id="total_deposit" name="total_deposit" class="number" value="<%= avg_deposit_dtl.isEmpty() == false ? avg_deposit_dtl.get(1).get("total_deposit") : "" %>" /></td>
							<td><input type="text" name="balance" class="number" value="<%= avg_deposit_dtl.isEmpty() == false ? avg_deposit_dtl.get(1).get("balance") : "" %>" /></td>
						</tr>
						
						<tr data-index="1">
							<td>
								<select name="month">
									<option value=""></option>
								<%
									html = "<option value='01'>January</option>"
										+ "<option value='02'>February</option>"
										+ "<option value='03'>March</option>"
										+ "<option value='04'>April</option>"
										+ "<option value='05'>May</option>"
										+ "<option value='06'>June</option>"
										+ "<option value='07'>July</option>"
										+ "<option value='08'>August</option>"
										+ "<option value='09'>September</option>"
										+ "<option value='10'>October</option>"
										+ "<option value='11'>November</option>"
										+ "<option value='12'>December</option>";
									
									if(avg_deposit_dtl.isEmpty() == false) {
										html = html.replace("<option value='" + avg_deposit_dtl.get(2).get("month") + "'>", "<option value='" + avg_deposit_dtl.get(2).get("month") + "' selected />");
									}
									
									out.println(html);
								%>
								</select>
							</td>
							<td><input type="text" id="total_deposit" name="total_deposit" class="number" value="<%= avg_deposit_dtl.isEmpty() == false ? avg_deposit_dtl.get(2).get("total_deposit") : "" %>" /></td>
							<td><input type="text" name="balance" class="number" value="<%= avg_deposit_dtl.isEmpty() == false ? avg_deposit_dtl.get(2).get("balance") : "" %>" /></td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		
		<div class="form-horizontal three-col" style="margin-top:30px">
			<h4>Amex Authorised Signatories</h4>
			<table class="tbl amex_auth_sign_tbl">
				<tr>
					<td>Title</td>
					<td>
						<select id="title_1">
							<option value=""></option>
							<%
								html = "<option value=''>Unknown</option>"
									+ "<option value='Mr'>Mr</option>"
									+ "<option value='Mrs'>Mrs</option>"
									+ "<option value='Miss'>Miss</option>"
									+ "<option value='Dato'>Dato</option>"
									+ "<option value='Datin'>Datin</option>"
									+ "<option value='Datuk'>Datuk</option>"
									+ "<option value='Tan Sri'>Tan Sri</option>"
									+ "<option value='Puan Sri'>Puan Sri</option>"
									+ "<option value='Y.B.'>Y.B.</option>"
									+ "<option value='Tuanku'>Tuanku</option>";
								
								if(amex_entries.isEmpty() == false) {
									html = html.replace("<option value='" + amex_entries.get(0).get("title") + "'>", "<option value='" + amex_entries.get(0).get("title") + "' selected />");
								}
								
								out.println(html);
							%>
						</select>
					</td>
					
					<td>Designation</td>
					<td><input type="text" id="designation_1" value="<%= amex_entries.isEmpty() == false && amex_entries.get(0).get("designation").equals("0") == false ? amex_entries.get(0).get("designation") : "" %>" /></td>
					
					<td>Date of Birth</td>
					<td><input type="text" id="dob_1" value="<%= amex_entries.isEmpty() == false ? amex_entries.get(0).get("dob") : "" %>" /></td>
				</tr>
				
				<tr>
					<td>Name</td>
					<td><input type="text" id="name_1" value="<%= amex_entries.isEmpty() == false ? amex_entries.get(0).get("name") : "" %>" /></td>
					
					<td>New IC No./Passpost No.</td>
					<td><input type="text" id="ic_1" value="<%= amex_entries.isEmpty() == false ? amex_entries.get(0).get("ic") : "" %>" /></td>
					
					<td>Gender</td>
					<td>
						<select id="gender_1">
							<%
								html = "<option value='0'></option>"
									+ "<option value='Male'>Male</option>"
									+ "<option value='Female'>Female</option>";
								
								if(amex_entries.isEmpty() == false) {
									html = html.replace("<option value='" + amex_entries.get(0).get("gender") + "'>", "<option value='" + amex_entries.get(0).get("gender") + "' selected />");
								}
								
								out.println(html);
							%>
						</select>
					</td>
				</tr>
				
				<tr class="padding">
					<td>Title</td>
					<td>
						<select id="title_2">
							<option value=""></option>
							<%
							html = "<option value=''>Unknown</option>"
									+ "<option value='Mr'>Mr</option>"
									+ "<option value='Mrs'>Mrs</option>"
									+ "<option value='Miss'>Miss</option>"
									+ "<option value='Dato'>Dato</option>"
									+ "<option value='Datin'>Datin</option>"
									+ "<option value='Datuk'>Datuk</option>"
									+ "<option value='Tan Sri'>Tan Sri</option>"
									+ "<option value='Puan Sri'>Puan Sri</option>"
									+ "<option value='Y.B.'>Y.B.</option>"
									+ "<option value='Tuanku'>Tuanku</option>";
								
								if(amex_entries.isEmpty() == false) {
									html = html.replace("<option value='" + amex_entries.get(1).get("title") + "'>", "<option value='" + amex_entries.get(1).get("title") + "' selected />");
								}
								
								out.println(html);
							%>
						</select>
					</td>
					
					<td>Designation</td>
					<td><input type="text" id="designation_2" value="<%= amex_entries.isEmpty() == false && amex_entries.get(1).get("designation").equals("0") == false ? amex_entries.get(1).get("designation") : "" %>" /></td>
					
					<td>Date of Birth</td>
					<td><input type="text" id="dob_2" value="<%= amex_entries.isEmpty() == false ? amex_entries.get(1).get("dob") : "" %>" /></td>
				</tr>
				
				<tr>
					<td>Name</td>
					<td><input type="text" id="name_2" value="<%= amex_entries.isEmpty() == false ? amex_entries.get(1).get("name") : "" %>" /></td>
					
					<td>New IC No./Passpost No.</td>
					<td><input type="text" id="ic_2" value="<%= amex_entries.isEmpty() == false ? amex_entries.get(1).get("ic") : "" %>" /></td>
					
					<td>Gender</td>
					<td>
						<select id="gender_2">
							<%
								html = "<option value='0'></option>"
									+ "<option value='Male'>Male</option>"
									+ "<option value='Female'>Female</option>";
								
								if(amex_entries.isEmpty() == false) {
									html = html.replace("<option value='" + amex_entries.get(1).get("gender") + "'>", "<option value='" + amex_entries.get(1).get("gender") + "' selected />");
								}
								
								out.println(html);
							%>
						</select>
					</td>
				</tr>
			</table>

		</div>
		
	</div>
</div>
